package com.iflytek.sbd.service.db;

import com.iflytek.sbd.po.Student;
import com.iflytek.sbd.po.db.Computer;
import org.springframework.cache.annotation.Cacheable;

/**
 * @program: sbd
 * @description: 测试redis缓存的service
 * @author: 陈英俊
 * @create: 2022-02-28 10:28
 */
public interface RedisService {

    // key作为缓存键
    @Cacheable(value = "getValueById", key = "#p0")
    String get(String key);


    // 对象的id属性作为缓存键
    @Cacheable(value = "computer:test:get1", key = "#p0.id")
    Computer get1(Computer computer);

    // 选择参数的属性作为缓存键
    @Cacheable(value = "computer:test:get1", key = "#p1.age")
    Computer get12(Computer computer, Student student);
}
